#include <bits/stdc++.h>
#include <bits/extc++.h>
#define int long long
#define Genshin return
#define Impact 0
using namespace __gnu_pbds;
using namespace std;
int n,m,fang[4][2]={{1,0},{0,1},{-1,0},{0,-1}},prx,pry,book[110][110],flag=0;
char a[110][110];
void bfs(int prx,int pry)
{
	queue<pair<int,int> > q;
	book[prx][pry]=1;
	q.push({prx,pry});
	while(!q.empty())
	{
		int i=q.front().first,j=q.front().second;
		q.pop();
		if(a[i][j]=='*') {flag=1;break;}
		for(int k=0;k<4;k++)
		{
			if(i+fang[k][0]<=0||i+fang[k][0]>n||j+fang[k][1]<=0||j+fang[k][1]>m) continue;
			if(book[i+fang[k][0]][j+fang[k][1]]||a[i+fang[k][0]][j+fang[k][1]]=='#') continue;
			book[i+fang[k][0]][j+fang[k][1]]=1;
			q.push({i+fang[k][0],j+fang[k][1]});
		}
	}
}
signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]=='#')
			{
				for(int k=0;k<4;k++)
				{
					if(i+fang[k][0]<=0||i+fang[k][0]>n||j+fang[k][1]<=0||j+fang[k][1]>m) continue;
					if(a[i+fang[k][0]][j+fang[k][1]]=='#'||a[i+fang[k][0]][j+fang[k][1]]=='*') a[i][j]='*';
				}
			}
			if(a[i][j]=='M') prx=i,pry=j;
		}
	}
	bfs(prx,pry);
	if(flag)
	{
		cout<<"yeah!";
		int sum=0;
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
				if(a[i][j]=='#') sum+=5;
				else if(a[i][j]=='*') sum++;
		}
		cout<<"\n"<<sum;
	}
	else cout<<"Game over!";
	//for(int i=1;i<=n;i++) {for(int j=1;j<=m;j++) cout<<a[i][j]<<" ";cout<<"\n";}
	Genshin Impact;
}
